import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Created by Administrator on 2017/6/27.
 */
public class Solution {
    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] s = new int[n];
        System.out.println("s.length:"+s.length);
        for(int i=0;i<s.length;i++){
            s[i] = in.nextInt();
            System.out.println("s["+i+"]:"+s[i]);
        }
        System.out.println("完了");
        int i,count;
        for(int j=0;j<s.length;j++){
            count=0;
            i=1;
            while(i<s[j]){
                if (divisor(i)==divisor(i+1))
                    count++;
                i++;
            }
            System.out.println(count);
        }

    }
    static int divisor(int a){
        Set<Integer> divs = new HashSet<>();
        int b = (int) Math.sqrt(a)+1;
        for(int i =1;i<=b;i++){
            if (a%i==0) {
                divs.add(a/i);
                divs.add(i);
            }
        }
        return divs.size();
    }
}
